package ch.elca.training.dom;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;


@Entity
@Table(name = Project.TABLE, uniqueConstraints = { @UniqueConstraint(columnNames = Project.COLUMN_PROJECT_NUMBER) })
public class Project extends BaseDom {

	public static final String TABLE = "PROJECT";

	
	private Integer projectNumber;
	private String projectName;
	private String customer;
	private String status;	
	private Date startDate;
	private Date endDate;

	protected static final String COLUMN_PROJECT_NUMBER = "PROJECTNUMBER";
	protected static final String COLUMN_PROJECT_NAME = "PROJECTNAME";	
	protected static final String COLUMN_START_DATE = "STARTDATE";
	protected static final String COLUMN_CUSTOMER = "CUSTOMER";
	protected static final String COLUMN_STATUS = "STATUS";
	protected static final String COLUMN_END_DATE = "ENDDATE";
	
	@Column(name = COLUMN_PROJECT_NUMBER, nullable = false)
	public Integer getProjectNumber() {
		return projectNumber;
	}

	public void setProjectNumber(Integer projectNumber) {
		this.projectNumber = projectNumber;
	}

	@Column(name = COLUMN_PROJECT_NAME, nullable = false, length = 100)
	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	@Column(name = COLUMN_CUSTOMER, nullable = false, length = 500)
	public String getCustomer() {
		return customer;
	}

	public void setCustomer(String customer) {
		this.customer = customer;
	}

	@Column(name = COLUMN_STATUS, nullable = false, columnDefinition = "enum('INV', 'TOV', 'VAL', 'FIN')", length = 3)
	@Enumerated()
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = COLUMN_START_DATE, nullable = false)
	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	@Column(name = COLUMN_END_DATE, nullable = true)
	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

}
